#include<reg52.h>
#define SMG P0
sbit KEY1 = P3^1;
sbit KEY2 = P3^0;
sbit KEY3 = P3^2;
sbit KEY4 = P3^3;
sbit LED1 = P2^0;
sbit LED2 = P2^1;
sbit LED3 = P2^2;
sbit LED4 = P2^3;
		
void delay_us(unsigned int time)
{
	while(time--);
}


void main()
{
	
	while(1)
	{
		delay_us(150);
		  if(KEY1 == 0) LED1 = 0;
			if(KEY2 == 0) LED2 = 0;
			if(KEY3 == 0) LED3 = 0;
			if(KEY4 == 0) LED4 = 0;
		if(KEY1 == 1 || KEY2 == 1 || KEY3 == 1 || KEY4 == 1 )
		{
			delay_us(150);
			if(KEY1 == 1) LED1 = 1;
			if(KEY2 == 1) LED2 = 1;
			if(KEY3 == 1) LED3 = 1;
			if(KEY4 == 1) LED4 = 1;
		}
	}
}